using System;
using System.Data.SqlClient;
using System.Web;
using System.Web.Profile;
using System.Web.UI.HtmlControls;
using Jungle.Code.BLL;
using Jungle.Code.DAL;
using System.Data;


partial class Modules_VisionEditor_user : BaseUserModule
{
	// Constructors _constructors;
	public Modules_VisionEditor_user() {
	}


	// Methods
	protected void Page_Load(object sender, EventArgs e) {
		/*string sqlString = "SELECT * FROM mdVisionEditor WHERE sectionID=" + base.section.sectionID;
		SqlDataReader reader1 = DBHelper.GetDataReader(sqlString);
		if (reader1.HasRows) {
			reader1.Read();
			if (reader1["content"] != DBNull.Value) {
				HtmlGenericControl child = new HtmlGenericControl();
				child.InnerHtml = HttpUtility.HtmlDecode((string)reader1["content"]);
				this.Controls.Add(child);
			}
		}
		reader1.Close();*/
		string content = GetContent(base.section.SectionID);
		HtmlGenericControl cont = new HtmlGenericControl();
		cont.InnerHtml = HttpUtility.HtmlDecode(content);
		this.Controls.Add(cont);
	}

	public string GetContent(int sectionID) {
		string cont = "";
		SqlConnection conn = new SqlConnection(DBHelper.ConnectionString);
		using (SqlCommand command = new SqlCommand("dbo.mdVisionEditor_GetBySectionID", conn)) {
			command.CommandType = CommandType.StoredProcedure;
			command.Parameters.Add("sectionID", SqlDbType.Int).Value = sectionID;
			conn.Open();
			SqlDataReader dr = command.ExecuteReader(CommandBehavior.CloseConnection);
			if (dr.HasRows) {
				dr.Read();
				cont = (string)dr["content"];
			}
			dr.Close();
		}
		return cont;
	}
}
